package proxy.a2_jdkproxy.reflect;

import proxy.a2_jdkproxy.util.ClassLoaderUtils;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class JDKProxy {

	public static <T> T getProxy(Class<T> interfaceClass) {
		InvocationHandler handler = new JDKInvocationHandler();
		ClassLoader classLoader = ClassLoaderUtils.getCurrentClassLoader();
		return (T) Proxy.newProxyInstance(classLoader, new Class[]{interfaceClass}, handler);
	}
}
